package com.more.offer.algorithm.leetcode.lcode03;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: yinpeng
 * @Date: 2019/9/25 11:45
 * @Description: TODO
 **/
public class Solution_01 {
	public static int lengthOfLongestSubstring(String s) {
		List<Character> charStr =new ArrayList<>();
		int n = 0;
		for (int j = 0; j < s.length(); j++) {
			for (int i = j; i < s.length(); i++) {
				if(!charStr.contains(s.charAt(i))){
					charStr.add(s.charAt(i));
				}else{
					if(charStr.size()>n) {
						n = charStr.size();
					}
					charStr.clear();
					break;
				}
			}
		}
		return charStr.size()>n? charStr.size() : n;
	}

	public static void main(String[] args) {
		/*int abcddeaabcdefghig = lengthOfLongestSubstring(" ");
		System.out.println(abcddeaabcdefghig);*/
		int max = Math.max(1, 2);
		System.out.println(max);
	}
}
